package seatiger.tomcat.catalina.core;

import seatiger.tomcat.catalina.Container;
import seatiger.tomcat.catalina.Engine;
import seatiger.tomcat.catalina.Service;

/**
 * StandardEngine 实现
 */
public class StandardEngine extends ContainerBase implements Engine {

    private Service service;

    private String mapperClass =
            "seatiger.tomcat.catalina.core.StandardEngineMapper";

    public StandardEngine(){
        pipeline.setBasic(new StandardEngineValve());
    }
    /**
     * 顶级接口没有父类
     * @param container
     */
    @Override
    public void setParent(Container container) {
        throw new IllegalArgumentException(sm.getString("standardEngine.notHost"));
    }

    @Override
    public void setService(Service service) {
        this.service = service;
    }

    @Override
    public Service getService() {
        return this.service;
    }

    @Override
    protected void addDefaultMapper(String mapperClass) {
        super.addDefaultMapper(this.mapperClass);
    }
}
